<?php
/**
 * Created by PhpStorm.
 * User: Vova
 * Date: 9/28/14
 * Time: 11:45 PM
 */



include_once("Model.class.php");

require_once("C:/xampp/htdocs/door-market/php/classes/db.class.php");

class Catalog_model extends Model {

    public function get_catalog_items($category,$sub_category,$page_number,$page_size){

        $items = db::getInstance()->get_catalog_items_for_page($category,$page_number,$page_size);

        $last_page_number = db::getInstance()->get_total_pages_number($category,$sub_category,$page_number,$page_size);

        //echo "get items";

        return $items;

    }
    public function get_catalog_last_page_number($category,$sub_category,$page_number,$page_size){
        $last_page_number = db::getInstance()->get_total_pages_number($category,$sub_category,$page_number,$page_size);
        return $last_page_number;
    }
    public function get_total_items_count($category,$sub_category,$page_number,$page_size){
        $total_count = db::getInstance()->get_total_items_count($category,$sub_category,$page_number,$page_size);
        return $total_count;
    }
    public function get_category_name($category_code){
        $res = 'undefined';

        switch (strtolower($category_code)) {
            case 'doors':
                $res = 'Двері';
                break;
            case 'stairs':
                $res = 'Сходи';
                break;
            case 'beds':
                $res = 'Ліжка';
                break;
            case 'tables':
                $res = 'Столи';
                break;
            case 'fires':
                $res = 'Каміни';
                break;
    }
        return $res;
    }
    public function get_items_count($category,$sub_category){

        return db::getInstance()->get_items_count($category,$sub_category);

    }


} 